package Controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import Model.BusinessRuleManager;
import Model.Content.LanguageList;
import Model.Languages.Template;
import View.MyFrame;
import View.MyGeneratedCode;

public class ActionEvents {

	public ActionEvents(final Controller c, final MyFrame v, final BusinessRuleManager BRList){
		
    	v.addCloseListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
    	});
    	
    	v.addSelectedToGenerateBListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent e) {
				BRList.SetToGenerate(v.getGeselecteerdeSelected());
			}
    	});
    	
    	v.addGenerateToSelectedBListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent e) {
				BRList.RemoveFromGenerate(v.getGeselecteerdeGenerate());
			}
    	});
    	
    	v.addAllToSelectedBListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent e) {
				BRList.SetAllToSelect();
			}
    	});
    	
    	v.addAllToGenerateBListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent e) {
				BRList.SetAllToGenerate();
			}
    	});
    	
    	v.addGenerateListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				c.setGenerateLanguage(v.getGenerateLanguage());
				new MyGeneratedCode(c.executeGenerator());
			}
    	});
		
		
	}
	
}
